#include "tracing.h"
GENERIK_TRACER_GLOBAL;

#include "toptions.h"
#include <iostream>

struct options
: generik::options
{
	// the list of parameters
	int x;
	std::string y;
	std::string filename;
	
	options()
	// the initial values of the parameters
	: x(456)
	, y("blah")
	, filename()
	{
		// the commandline flags which affect the parameters
		GENERIK_ADD_DEFAULT_USAGE;
		GENERIK_ADD_DEFAULT_UNKNOWN;
		add("i:", "[-i <int>]", "sets the integer x value", setx);
		add("s:", "[-s <string>]", "sets the string y value", sety);
		add("",   "<filename>", "filename to process", setfilename);
		GENERIK_ADD_CATCH_OVERFLOW;
	}
	
	GENERIK_OPTIONAL_ARG_FUNC(options, x);
	GENERIK_OPTIONAL_ARG_FUNC(options, y);
	GENERIK_REQUIRED_ARG_FUNC(options, filename);
};

int main(int argc, char** argv)
{
	GENERIK_TRACER;
	
	options opts;
	opts.run(argc, argv);
	
	std::cout<<"x is "<<opts.x<<std::endl;
	std::cout<<"y is "<<opts.y<<std::endl;
	
	return 0;
}



